#pragma once
#include "CCollection.h"

class CDoubleCollection :
	public CCollection
{
private: 
	CDoubleCollection(CCoreServices * pCore);
	HRESULT InitFromString(XUINT32 cString, XUINT16 * pString);
public: 
	virtual ~CDoubleCollection();
	static HRESULT Create(CDependencyObject * * ppObject, CREATEPARAMETERS * pCreate);
	virtual XUINT32 GetTypeIndex() const;
	virtual HRESULT Append(CValue & value, XUINT32 * pnIndex);
	virtual HRESULT Insert(XUINT32 nIndex, CValue & value);
	virtual void * RemoveAt(XUINT32 nIndex);
	virtual void * GetItem(XUINT32 nIndex);
	virtual HRESULT IndexOf(CValue & value, XINT32 * pIndex);
	virtual HRESULT Move(XINT32 nIndex, XINT32 nPosition);
protected: 
	virtual HRESULT OnAddToCollection(const CValue & value);
	virtual HRESULT OnRemoveFromCollection(const CValue & value, XINT32 iPreviousIndex);
	virtual HRESULT OnClear();
	virtual XUINT8 * GetFlattened();
	virtual void SetFlattened(XUINT8 * pFlattened);
	virtual XUINT8 * * GetBlocks();
	virtual void SetBlocks(XUINT8 * * ppBlocks);
private: 
	static HRESULT EnsureValue(const CValue & vOriginal, CValue & vCoerced);
	void SetChangedFlags();
	virtual void ReleaseItem(void * pItem);
	struct FloatBlock * * m_pBlocks;
	XFLOAT * m_pFlattened;
};